#include <stdio.h>
int main()
{
    int n, move;
    int a[100];
    int temp;
    scanf("%d %d", &n, &move);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    for (int j = 0; j < move; j++)
    {
        temp = a[n - 1];
        for (int i = n - 1; i >= 0; i--)
            a[i] = a[i - 1];
        a[0] = temp;
    }
    for (int i = 0; i < n; i++)
        if (i < n - 1)
            printf("%d ", a[i]);
        else
            printf("%d\n", a[i]);
    return 0;
}